package com.x.schedule.DAO.impl;

import com.x.schedule.DAO.BaseDao;
import com.x.schedule.DAO.SysScheduleDAO;
import com.x.schedule.pojo.SysSchedule;

import java.util.List;

/**
 * ClassName: SysScheduleDAOImpl
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.08.27 17:48
 */
public class SysScheduleDAOImpl extends BaseDao implements SysScheduleDAO {
    @Override
    public int addSchedule(SysSchedule schedule) {
        String sql = "insert into sys_schedule values(default, ?, ?, ?)";
        int rows = baseUpdate(sql, schedule.getUid(), schedule.getTitle(), schedule.getCompleted());//Lombok插件已经实现get方法
        return rows;
    }

    @Override
    public List<SysSchedule> findAll() {
        String sql = "select sid, uid, title, completed from sys_schedule";
        List<SysSchedule> list = baseQuery(SysSchedule.class, sql);
        return list;
    }
}
